﻿
@{
	Layout = null;
}
<style>
	/*.ui-jqgrid .ui-jqgrid-bdiv{
		border-top:1px solid #74e8b5;
		overflow-x:auto;
	}

	.frozen-div, .frozen-bdiv{
		background-color:#fff;
	}*/
</style>
<div id="dv_edit_op">
	<div>
		<table id="gridopList"></table>
	</div>
	<div>
		@Html.Partial("MainOpEdit")
	</div>
</div>
<script>

	function OpListGrid() {
		var $gridList = $("#gridopList");
		$gridList.dataGrid({
			postData: {
				bah: $("#BAH").val(),
				zyh: $("#ZYH").val(),
			},
			url: "/MRHomePage/MRHomePage/GetOpGridList",
			height: $(window).height() - 150,
			width: $(window).width() - 120,
			colModel: [
				{ label: "Id", name: "Id", hidden: true },
				{ label: "病案号", name: "BAH", width: 60, align: 'left' },
				{ label: "住院号", name: "ZYH", width: 60, align: 'left' },
				{ label: "手术及<br />操作编码", name: "SSJCZBM", width: 80, align: 'center' },
				{ label: "手术及<br />操作日期", name: "SSJCZRQ", width: 130, align: 'center', formatter: "date", formatoptions: { srcformat: 'Y-m-d H:i:s', newformat: 'Y-m-d H:i:s' } },
				{ label: "手术<br />级别", name: "SSJB", width: 60, align: 'center' },
				//{ label: "CYQK", name: "CYQK", hidden: true },
				{ label: "手术及操作名称", name: "SSJCZMC", width: 150, align: 'center' },
				{ label: "SZ", name: "SZ", hidden: true },
				{ label: "主刀医生", name: "SZMC", width: 50, align: 'center' },
				{ label: "YZ", name: "YZ", hidden: true },
				{ label: "I助", name: "YZMC", width: 50, align: 'center' },
				{ label: "EZ", name: "EZ", hidden: true },
				{ label: "II助", name: "EZMC", width: 50, align: 'center' },
				{ label: "QKDJ", name: "QKDJ", hidden: true },
				{ label: "QKYHLB", name: "QKYHLB", hidden: true },
				{ label: "切口愈<br />合等级", name: "QKYHDJ", width: 50, align: 'center' },
				//{
				//    label: "切口愈<br />合等级", name: "QKYHDJ", width: 50, align: 'center', formatter: function (row, option, data) {
				//        return data.QKDJ + "/" + data.QKYLB;
				//    }
				//},
				{ label: "MZYS", name: "MZYS", hidden: true },
                { label: "麻醉医生：", name: "MZYSMC", width: 50, align: 'center' },
				{ label: "MZFS", name: "MZFS", hidden: true },
				{ label: "麻醉方式", name: "MZFSMS", width: 100, align: 'center' },
				{ label: "SSLX", name: "SSLX", hidden: true },
				{
					label: "是否<br />急诊手术", name: "SSLX", width: 100, align: 'center', formatter: function (row, option, data) {
						if (data.SSLX == "0") {
							return "否";
						}
						else {
							return "是";
						}
					}
				},
				{ label: "SSKSSJ", name: "SSKSSJ", hidden: true },
				{ label: "手术<br />开始日期", name: "SSKSSJ", width: 130, align: 'center', formatter: "date", formatoptions: { srcformat: 'Y-m-d H:i:s', newformat: 'Y-m-d H:i:s' } },
				{ label: "SSJSSJ", name: "SSJSSJ", hidden: true },
				{ label: "手术<br />结束日期", name: "SSJSSJ", width: 130, align: 'center', formatter: "date", formatoptions: { srcformat: 'Y-m-d H:i:s', newformat: 'Y-m-d H:i:s' } },
				{ label: "SQZBSJT", name: "SQZBSJT", hidden: true },
				{ label: "术前<br />准备天数", name: "SQZBSJT", width: 50, align: 'center' },
				{ label: "SQYFKJGYS", name: "SQYFKJGYS", hidden: true },
				{ label: "术前预防性<br />抗菌药物给药时间：", name: "SQYFKJGYS", width: 130, align: 'center', formatter: "date", formatoptions: { srcformat: 'Y-m-d H:i:s', newformat: 'Y-m-d H:i:s' } },

				{ label: "MZKSSJNYR", name: "MZKSSJNYR", hidden: true },
				{ label: "麻醉开始时间：", name: "MZKSSJNYR", width: 130, align: 'center', formatter: "date", formatoptions: { srcformat: 'Y-m-d H:i:s', newformat: 'Y-m-d H:i:s' } },
				{ label: "MZFJ_ASA", name: "MZFJ_ASA", hidden: true },
				{ label: "ASA<br />麻醉分级：", name: "MZFJ_ASA", width: 50, align: 'center' },
				{ label: "QKBW", name: "QKBW", hidden: true },
				{ label: "切口部位 ：", name: "QKBW", width: 50, align: 'center' },
				{ label: "SSQKGR", name: "SSQKGR", hidden: true },
				{
					label: "手术<br />切口感染 ：", name: "SSQKGR", width: 50, align: 'center'
				},
				{ label: "SSBFZ", name: "SSBFZ", hidden: true },
				{
					label: "手术<br />并发症", name: "SSBFZ", width: 100, align: 'center'
				},
				{ label: "SSBFZMC", name: "SSBFZMC", hidden: true },
				{ label: "手术<br />并发症名称", name: "SSBFZMC", width: 100, align: 'center' },
				{ label: "zt", name: "zt", hidden: true },
				{
					label: "状态", name: "ztsm", width: 50, align: 'center', formatter: function (row, option, data) {
						if (data.zt == "0") {
							return "作废";
						}
						else {
							return "正常";
						}
					}
				}
			],
			shrinkToFit: false,
			autoScroll: true,
			onSelectRow: function (row) {
				$(".dv-left").show();
				var rowData = $('#gridopList').jqGrid('getRowData', row);
				$("#op_ssdm").val(rowData.SSJCZMC);
				$("#op_ssdm").attr("attr-ssdm", rowData.SSJCZBM);
				$("#op_ssdm").attr("attr-ssjb", rowData.SSJB);
				$("#op_ssrq").val(rowData.SSJCZRQ);
				$("#op_ssdm").val(rowData.SSJCZMC);
				$("#op_yhdj").val(rowData.QKDJ).trigger("change");
				$("#op_yhlb").val(rowData.QKYHLB).trigger("change");
				$("#op_mzfs").val(rowData.MZFS).trigger("change");
				$("#op_zdys").val(rowData.SZMC);
				$("#op_zdys").attr("data-StaffGh", rowData.SZ);
				$("#op_sszl1").val(rowData.YZMC);
				$("#op_sszl1").attr("data-StaffGh", rowData.YZ);
				$("#op_sszl2").val(rowData.EZMC);
				$("#op_sszl2 ").attr("data-StaffGh", rowData.EZ);
				$("#op_mzys").val(rowData.MZYSMC);
				$("#op_mzys").attr("data-StaffGh", rowData.MZYS);
				var index = rowData.SSLX == "择期手术" ? '0' : '1';
				$("#SSLX").val(index);
				$("#SSKSSJ").val(rowData.SSKSSJ);
				$("#SSJSSJ").val(rowData.SSJSSJ);
				$("#SQZBSJT").val(rowData.SQZBSJT);
				$("#SQYFKJGYS").val(rowData.SQYFKJGYS);
                $("#op_mzys").val(rowData.MZYSMC);
				$("#op_mzys").attr("data-StaffGh", rowData.MZYS);
				$("#MZFJ_ASA").val(rowData.MZFJ_ASA);
				$("#MZKSSJNYR").val(rowData.MZKSSJNYR);
				$("#QKBW").val(rowData.QKBW);
				$("#SSJB").val(rowData.SSJB);
				var tt = rowData.SSQKGR == "有" ? 1 : 2;
				$("#SSQKGR").val(tt);
				var ff = rowData.SSBFZ == "有" ? '1' : '2';
				$("#SSBFZ").val(ff);

				var arr = rowData.SSBFZMC.split(',')
				var obj = document.getElementsByName("SSBFZMC");
				for (var i = 0; i < arr.length; i++) {
					for (k in obj) {
						if (arr[i] == obj[k].value) {
							var id = obj[k].id
							$("#" + obj[k].id).prop("checked", true);
						}
					}
				}

				$("#op_rowid").val(row);

			},
			loadComplete: function () {

			},
			gridComplete: function () {

				$("#gridopList").closest(".ui-jqgrid-bdiv").css({ "overflow-x": "scroll" });
			},
			/*caption: "手术列表",*/

			//rowNum: 15,
			//pager: "#gridzdPager",
			viewrecords: false,
			shrinkToFit: false,
			autoScroll: true

		});
		// jQuery("#gridopList").jqGrid('navGrid', '#gridzdPager', { edit: false, add: false, del: false });
		jQuery("#gridopList").jqGrid('sortableRows');

	}

</script>